import java.util.StringTokenizer;


public class P11388_39643 {

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuilder buffer = new StringBuilder();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString());
	}
	
	public static void main(String[] args) {
		int cases = Integer.parseInt(readLn());
		
		for (int k = 0; k < cases; k++) {
			StringTokenizer st = new StringTokenizer(readLn());
			int G = Integer.parseInt(st.nextToken());
			int L = Integer.parseInt(st.nextToken());
			
			if ( L % G != 0) System.out.println(-1);
			else {
				if (G < L) { 
					int aux = G;
					G = L;
					L = aux;
				}
				
				System.out.println(L + " " + G);
				
			}
			
		}
		
	}
	
    static int gcd( int a, int b ) {
        return b != 0 ? gcd( b,  a % b ) : a;

    }
    
    static int lcm(int a, int b) {
    	return a * b / gcd(a, b);
    }
}
